<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="layui/css/layui.css"  media="all">
</head>
<body>
	<form class="layui-form">
		<div class="layui-form-item">
			<label class="layui-form-label"><span style="color: red;">*</span>
			使用者</label>
			<div class="layui-input-inline">
				<input type="text" name="rname" id="rname" required lay-verify="required"
					placeholder="请输入" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><span style="color: red;">*</span>
		开始时间</label>
			<div class="layui-input-inline">
				<input type="text" name="renter" id="renter" required lay-verify="required"
					placeholder="请输入" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><span style="color: red;">*</span>
		结束时间</label>
			<div class="layui-input-inline">
				<input type="text" name="rleave" id="rleave" required lay-verify="required"
					placeholder="请输入" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label"><span style="color: red;">*</span>
			所属阅览室</label>
			<div class="layui-input-inline">
				<input type="text" name="reid" id="reid" required lay-verify="required"
					placeholder="请输入" autocomplete="off" class="layui-input">
			</div>
		</div>
		
	
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit lay-filter="formDemo">立即添加</button>
			</div>
		</div>
	</form>
</body>
	<script type="text/javascript" src="layui/layui.js"></script>
	<script>
		layui.use(['form','upload'], function() {
			var form = layui.form;
			var upload=layui.upload;
			var $ = layui.jquery; 
			form.on('submit(formDemo)', function(data) {
				var d = data.field;
				d.method = "Recorinserts";
				console.log(d);
				var url = '/Recorinserts';
				$.post(url, d, function(data) {
					if (data.count > 0) {
						console.log('添加成功');
						var index = parent.layer.getFrameIndex(window.name); 
						parent.layer.close(index); 
					}
				}, "json");
				return false;
			});
		});
	</script>
</html>